class MembersController < ApplicationController
  layout 'base.html', :only => :show

  def show
    if params[:cmd] == "active_member"
      @valleyers = Valleyer.all :order => "updated_at desc"
    else
      @valleyers = Valleyer.all :order => "created_at desc"
    end
  end

  def index
    #初始化变量
    if params[:nick_name].blank?
      nick_name = "%"
    else
      nick_name = params[:nick_name]
    end

    if params[:sex].blank?
      sex = "%"
    else
      sex = params[:sex]
    end

    @valleyers = Valleyer.all :conditions => ["nick_name like ? and sex like ?",
      "%" + nick_name + "%",
      sex
    ]
    @make_friend_requisition = WaitMakeFriendRequisition.new :active_valleyer_id => current_valleyer_id,
        :passive_valleyer_id => params[:valleyer_id]
    @make_friend_requisition.save
  end

  def authorize

  end
end
